<template>
  <h1>表单组件</h1>
  <h2>注册页面</h2>
  <el-form label-width="80" style="width: 500px;margin: 0 auto">
      <el-form-item label="用户名">
          <el-input placeholder="请输入用户名" v-model="user.username"></el-input>
      </el-form-item>
    <el-form-item label="密码">
      <el-input show-password placeholder="请输入密码" v-model="user.password"></el-input>
    </el-form-item>
    <el-form-item label="性别">
      <el-radio-group v-model="user.gender">
        <el-radio-button label="男" name="gender" value="1"></el-radio-button>
        <el-radio-button label="女" name="gender" value="0"></el-radio-button>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="所在地">
        <el-select placeholder="请选择你所在的城市" v-model="user.city">
            <el-option value="北京">北京</el-option>
            <el-option value="上海">上海</el-option>
            <el-option value="成都">成都</el-option>
            <el-option value="重庆">重庆</el-option>
        </el-select>
    </el-form-item>
    <el-form-item label="管理员">
      <el-switch v-model="user.isAdmin" />
    </el-form-item>
    <el-form-item>
      <el-button type="success" @click="register()">注册</el-button>
    </el-form-item>

  </el-form>
</template>

<script setup>
import {ref} from 'vue';
const user=ref({
  username:"",
  password:"",
  gender:"0",
  city:"上海",
  isAdmin:"true"
})
const register =()=>{
  console.log(user.value);
}
</script>


<style scoped>

</style>